3.1.25 \(\int \cos ^4(c+d x) (a+i a \tan (c+d x))^2 \, dx\) [25]

Optimal. Leaf size=63 \[ \frac {a^2 x}{4}-\frac {i a^4}{4 d (a-i a \tan (c+d x))^2}-\frac {i a^3}{4 d (a-i a \tan (c+d x))} \]

[Out]

1/4*a^2*x-1/4*I*a^4/d/(a-I*a*tan(d*x+c))^2-1/4*I*a^3/d/(a-I*a*tan(d*x+c))

________________________________________________________________________________________

Rubi [A]
time = 0.05, antiderivative size = 63, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 24, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {3568, 46, 212} \begin {gather*} -\frac {i a^4}{4 d (a-i a \tan (c+d x))^2}-\frac {i a^3}{4 d (a-i a \tan (c+d x))}+\frac {a^2 x}{4} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^4*(a + I*a*Tan[c + d*x])^2,x]

[Out]

(a^2*x)/4 - ((I/4)*a^4)/(d*(a - I*a*Tan[c + d*x])^2) - ((I/4)*a^3)/(d*(a - I*a*Tan[c + d*x]))

Rule 46

Int[((a_) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d*x
)^n, x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && ILtQ[m, 0] && IntegerQ[n] &&  !(IGtQ[n, 0] && Lt
Q[m + n + 2, 0])

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 3568

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rubi steps

\begin {align*} \int \cos ^4(c+d x) (a+i a \tan (c+d x))^2 \, dx &=-\frac {\left (i a^5\right ) \text {Subst}\left (\int \frac {1}{(a-x)^3 (a+x)} \, dx,x,i a \tan (c+d x)\right )}{d}\\ &=-\frac {\left (i a^5\right ) \text {Subst}\left (\int \left (\frac {1}{2 a (a-x)^3}+\frac {1}{4 a^2 (a-x)^2}+\frac {1}{4 a^2 \left (a^2-x^2\right )}\right ) \, dx,x,i a \tan (c+d x)\right )}{d}\\ &=-\frac {i a^4}{4 d (a-i a \tan (c+d x))^2}-\frac {i a^3}{4 d (a-i a \tan (c+d x))}-\frac {\left (i a^3\right ) \text {Subst}\left (\int \frac {1}{a^2-x^2} \, dx,x,i a \tan (c+d x)\right )}{4 d}\\ &=\frac {a^2 x}{4}-\frac {i a^4}{4 d (a-i a \tan (c+d x))^2}-\frac {i a^3}{4 d (a-i a \tan (c+d x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.33, size = 86, normalized size = 1.37 \begin {gather*} \frac {a^2 (-4 i+(-i+4 d x) \cos (2 (c+d x))+(1-4 i d x) \sin (2 (c+d x))) (\cos (2 (c+2 d x))+i \sin (2 (c+2 d x)))}{16 d (\cos (d x)+i \sin (d x))^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^4*(a + I*a*Tan[c + d*x])^2,x]

[Out]

(a^2*(-4*I + (-I + 4*d*x)*Cos[2*(c + d*x)] + (1 - (4*I)*d*x)*Sin[2*(c + d*x)])*(Cos[2*(c + 2*d*x)] + I*Sin[2*(
c + 2*d*x)]))/(16*d*(Cos[d*x] + I*Sin[d*x])^2)

________________________________________________________________________________________

Maple [A]
time = 0.22, size = 100, normalized size = 1.59

method result size
risch \(\frac {a^{2} x}{4}-\frac {i a^{2} {\mathrm e}^{4 i \left (d x +c \right )}}{16 d}-\frac {i a^{2} {\mathrm e}^{2 i \left (d x +c \right )}}{4 d}\) \(44\)
derivativedivides \(\frac {-a^{2} \left (-\frac {\sin \left (d x +c \right ) \left (\cos ^{3}\left (d x +c \right )\right )}{4}+\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{8}+\frac {d x}{8}+\frac {c}{8}\right )-\frac {i a^{2} \left (\cos ^{4}\left (d x +c \right )\right )}{2}+a^{2} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )}{d}\) \(100\)
default \(\frac {-a^{2} \left (-\frac {\sin \left (d x +c \right ) \left (\cos ^{3}\left (d x +c \right )\right )}{4}+\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{8}+\frac {d x}{8}+\frac {c}{8}\right )-\frac {i a^{2} \left (\cos ^{4}\left (d x +c \right )\right )}{2}+a^{2} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )}{d}\) \(100\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^4*(a+I*a*tan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(-a^2*(-1/4*sin(d*x+c)*cos(d*x+c)^3+1/8*sin(d*x+c)*cos(d*x+c)+1/8*d*x+1/8*c)-1/2*I*a^2*cos(d*x+c)^4+a^2*(1
/4*(cos(d*x+c)^3+3/2*cos(d*x+c))*sin(d*x+c)+3/8*d*x+3/8*c))

________________________________________________________________________________________

Maxima [A]
time = 0.49, size = 67, normalized size = 1.06 \begin {gather*} \frac {{\left (d x + c\right )} a^{2} + \frac {a^{2} \tan \left (d x + c\right )^{3} + 3 \, a^{2} \tan \left (d x + c\right ) - 2 i \, a^{2}}{\tan \left (d x + c\right )^{4} + 2 \, \tan \left (d x + c\right )^{2} + 1}}{4 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^4*(a+I*a*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

1/4*((d*x + c)*a^2 + (a^2*tan(d*x + c)^3 + 3*a^2*tan(d*x + c) - 2*I*a^2)/(tan(d*x + c)^4 + 2*tan(d*x + c)^2 +
1))/d

________________________________________________________________________________________

Fricas [A]
time = 0.36, size = 41, normalized size = 0.65 \begin {gather*} \frac {4 \, a^{2} d x - i \, a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} - 4 i \, a^{2} e^{\left (2 i \, d x + 2 i \, c\right )}}{16 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^4*(a+I*a*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

1/16*(4*a^2*d*x - I*a^2*e^(4*I*d*x + 4*I*c) - 4*I*a^2*e^(2*I*d*x + 2*I*c))/d

________________________________________________________________________________________

Sympy [A]
time = 0.13, size = 87, normalized size = 1.38 \begin {gather*} \frac {a^{2} x}{4} + \begin {cases} \frac {- 4 i a^{2} d e^{4 i c} e^{4 i d x} - 16 i a^{2} d e^{2 i c} e^{2 i d x}}{64 d^{2}} & \text {for}\: d^{2} \neq 0 \\x \left (\frac {a^{2} e^{4 i c}}{4} + \frac {a^{2} e^{2 i c}}{2}\right ) & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**4*(a+I*a*tan(d*x+c))**2,x)

[Out]

a**2*x/4 + Piecewise(((-4*I*a**2*d*exp(4*I*c)*exp(4*I*d*x) - 16*I*a**2*d*exp(2*I*c)*exp(2*I*d*x))/(64*d**2), N
e(d**2, 0)), (x*(a**2*exp(4*I*c)/4 + a**2*exp(2*I*c)/2), True))

________________________________________________________________________________________

Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 257 vs. \(2 (49) = 98\).
time = 0.74, size = 257, normalized size = 4.08 \begin {gather*} \frac {8 \, a^{2} d x e^{\left (4 i \, d x + 2 i \, c\right )} + 16 \, a^{2} d x e^{\left (2 i \, d x\right )} + 8 \, a^{2} d x e^{\left (-2 i \, c\right )} - i \, a^{2} e^{\left (4 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 2 i \, a^{2} e^{\left (2 i \, d x\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - i \, a^{2} e^{\left (-2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + i \, a^{2} e^{\left (4 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x\right )} + e^{\left (-2 i \, c\right )}\right ) + 2 i \, a^{2} e^{\left (2 i \, d x\right )} \log \left (e^{\left (2 i \, d x\right )} + e^{\left (-2 i \, c\right )}\right ) + i \, a^{2} e^{\left (-2 i \, c\right )} \log \left (e^{\left (2 i \, d x\right )} + e^{\left (-2 i \, c\right )}\right ) - 2 i \, a^{2} e^{\left (8 i \, d x + 6 i \, c\right )} - 12 i \, a^{2} e^{\left (6 i \, d x + 4 i \, c\right )} - 18 i \, a^{2} e^{\left (4 i \, d x + 2 i \, c\right )} - 8 i \, a^{2} e^{\left (2 i \, d x\right )}}{32 \, {\left (d e^{\left (4 i \, d x + 2 i \, c\right )} + 2 \, d e^{\left (2 i \, d x\right )} + d e^{\left (-2 i \, c\right )}\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^4*(a+I*a*tan(d*x+c))^2,x, algorithm="giac")

[Out]

1/32*(8*a^2*d*x*e^(4*I*d*x + 2*I*c) + 16*a^2*d*x*e^(2*I*d*x) + 8*a^2*d*x*e^(-2*I*c) - I*a^2*e^(4*I*d*x + 2*I*c
)*log(e^(2*I*d*x + 2*I*c) + 1) - 2*I*a^2*e^(2*I*d*x)*log(e^(2*I*d*x + 2*I*c) + 1) - I*a^2*e^(-2*I*c)*log(e^(2*
I*d*x + 2*I*c) + 1) + I*a^2*e^(4*I*d*x + 2*I*c)*log(e^(2*I*d*x) + e^(-2*I*c)) + 2*I*a^2*e^(2*I*d*x)*log(e^(2*I
*d*x) + e^(-2*I*c)) + I*a^2*e^(-2*I*c)*log(e^(2*I*d*x) + e^(-2*I*c)) - 2*I*a^2*e^(8*I*d*x + 6*I*c) - 12*I*a^2*
e^(6*I*d*x + 4*I*c) - 18*I*a^2*e^(4*I*d*x + 2*I*c) - 8*I*a^2*e^(2*I*d*x))/(d*e^(4*I*d*x + 2*I*c) + 2*d*e^(2*I*
d*x) + d*e^(-2*I*c))

________________________________________________________________________________________

Mupad [B]
time = 3.27, size = 50, normalized size = 0.79 \begin {gather*} \frac {a^2\,x}{4}+\frac {\frac {a^2\,\mathrm {tan}\left (c+d\,x\right )}{4}+\frac {a^2\,1{}\mathrm {i}}{2}}{d\,\left ({\mathrm {tan}\left (c+d\,x\right )}^2+\mathrm {tan}\left (c+d\,x\right )\,2{}\mathrm {i}-1\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)^4*(a + a*tan(c + d*x)*1i)^2,x)

[Out]

(a^2*x)/4 + ((a^2*tan(c + d*x))/4 + (a^2*1i)/2)/(d*(tan(c + d*x)*2i + tan(c + d*x)^2 - 1))

________________________________________________________________________________________